package com.example.demo;

import com.example.demo.utils.PastUtil;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Created by xy on 2017/6/13.
 */
@Controller
public class GetConfig {
    /*@RequestMapping(value = "/getConfig")
    @ResponseBody
    public String getConfig(String url){
        return PastUtil.getParam(PastUtil.appId,PastUtil.appSecret,url);
    }*/

    @RequestMapping(value = "/index")
    public String index(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap){
        StringBuffer url=request.getRequestURL();
        if(!StringUtils.isEmpty(request.getQueryString())){
            url.append(request.getQueryString());
        }
        modelMap.put("param",PastUtil.getParam(PastUtil.appId,PastUtil.appSecret,new String(url)));
        return "index";
    }



}
